home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / The World of Computer Software.iso / cmdlg7.zip / MYOPEN_.PAS < prev    next >
Pascal/Delphi Source File  |  1992-12-10  |  2KB  |  109 lines

  1. {µµµµµµµµµµµµµµµµµµµµµµµµµµµµµµµµµµµµµµµµµµ}
  2. {   \\\                                    }
  3. {  -(j)-                                   }
  4. {    /juanca                               }
  5. {    ~                                     }
  6. {   ⌐ ACASA 1989-1992, All rights reserved }
  7. {µµµµµµµµµµµµµµµµµµµµµµµµµµµµµµµµµµµµµµµµµµ}
  8.  
  9. { tMyOpenDlg, this is how to override tFileNameDlg, to set your own file specs, extensions
  10.   dialog looks, etc.
  11. }
  12.  
  13. UNIT MYOPEN_;
  14. {$C MOVEABLE DEMANDLOAD DISCARDABLE}
  15. INTERFACE
  16.   USES
  17.     FNAMEDLG;
  18.  
  19.  
  20.   { the following dialog is a CommonFileDialog,
  21.     it overrides file specification for .WAV files}
  22. TYPE
  23.   pMyOpenDlg = ^tMyOpenDlg;
  24.   tMyOpenDlg = OBJECT(tFileNameDlg)
  25.  
  26.       option :Word;
  27.  
  28.       FUNCTION
  29.       defSpec :PChar;
  30.         virtual;
  31.  
  32.       FUNCTION
  33.       defExt :PChar;
  34.         virtual;
  35.  
  36.       FUNCTION
  37.       defSpecPos:Byte;
  38.         virtual;
  39.  
  40.       FUNCTION
  41.       openFlags :Longint;
  42.         virtual;
  43.  
  44.       FUNCTION
  45.       canClose :bOOLEAN;
  46.         virtual;
  47.   END;
  48.  
  49. IMPLEMENTATION
  50.   USES
  51.     WINPROCS; { to getDlgItemChecked }
  52.     {$I CDLG.INC }
  53.  
  54.       FUNCTION
  55.       tMyOpenDlg.
  56.       {}
  57.       defSpec :PChar;
  58.         begin
  59.           { two file specifications, just to show it off,
  60.             ALL #0 ARE NEEDED, specs in () only for user information
  61.           } 
  62.           defSpec := 'SoundFiles (*.wav)'#0'*.wav'#0'Joke Files (*.jok)'#0'*.jok'#0
  63.         end;
  64.  
  65.       FUNCTION
  66.       tMyOpenDlg.
  67.       {}
  68.       defExt :PChar;
  69.         begin
  70.           { default extension for files without one,
  71.             rembember NO DOT (.)
  72.           }
  73.           defExt := 'wav'
  74.         end;
  75.  
  76.       FUNCTION
  77.       tMyOpenDlg.
  78.       {}
  79.       defSpecPos:Byte;
  80.         begin
  81.           defSpecPos := 2  { just to show how to use this method }
  82.         end;
  83.  
  84.       FUNCTION
  85.       tMyOpenDlg.
  86.       {}
  87.       openFlags :Longint;
  88.         begin
  89.           { here go OFN_XXX flags, change if you like }
  90.           openFlags := tFileNameDlg.openFlags  
  91.         end;
  92.  
  93.       FUNCTION
  94.       tMyOpenDlg.
  95.       {}
  96.       canClose :bOOLEAN;
  97.         begin
  98.           canClose := tFileNameDlg.canClose;
  99.           if isDlgButtonChecked(hwindow, id_Superb) <> 0
  100.           then
  101.             option := id_Superb
  102.           else if isDlgButtonChecked(hwindow, id_JustOk) <> 0
  103.           then
  104.             option := id_JustOk
  105.           else
  106.             option := id_YourOwn
  107.         end;
  108. END.
  109.